<template>
  <div class="change-select-box clearfix">
    <div :class="{'need-fix':isfix}" class="change-select" >
      <ul class="clearfix">
        <li
          v-for="(item, selectIndex) in selectData" :key="(item, selectIndex)" :class="{'active_color': index === item.value}"
          @click="changeSelectData(item)">
          <p/>
          <p>{{ item.name }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    isfix: {
      type: Boolean,
      default: true
    },
    selectData: {
      type: Array,
      default: function () {
        return []
      }
    },
    changeNum: {
      type: Number,
      default: 0
    }
  },
  data () {
    return {
      index: 0,
      title: ''
    }
  },
  watch: {
    changeNum: function (val) {
      this.index = val
    }
  },
  methods: {
    changeSelectData (item) {
      this.index = item.value
      this.$emit('changeSelect', item)
    }
  }
}
</script>
<style lang="scss" scoped>
.need-fix {
  position: fixed;
  top: 1.7rem;
  right: 1%;
  background: #0e0a2e;
}
.change-select {
  width: 95%;
  z-index: 20;
  padding-left: 5%;

  ul {
    li {
      display: flex;
      display: -webkit-flex;
      margin-right: 5px;

      p {
        line-height: 0.6rem;
      }
      p:nth-child(1) {
        width: 0.25rem;
        height: 0.2rem;
        margin-top: 0.17rem;
        margin-right: 0.1rem;
        background: rgba(174, 174, 174, 0.5);
      }
      p:nth-child(2) {
        flex: 1;
      }
      &.active_color {
        p:nth-child(1) {
          background: #ed7d31;
        }
      }
    }
  }
}
</style>
